package com.dream.utils.web.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * @copyright evan
 * @author evan
 * @Revision
 * @date 2012/09/22
 */
public class AuthorityChooseTag extends TagSupport {
	private static final long serialVersionUID = 1L;
	
	private boolean isSubTagClose = false; 
	
	public AuthorityChooseTag() {
		super();
	}
	
	@Override
	public void release() {
		super.release();
		isSubTagClose = false;
	}
	
	@Override
	public int doStartTag() throws JspException {
		isSubTagClose = false; 
		return EVAL_BODY_INCLUDE;
	}

	public synchronized boolean hasSubTag() {
		return (!isSubTagClose);
	}

	public synchronized void subTagColsed() {
		if (isSubTagClose)
			throw new IllegalStateException("choose tag exception");
		isSubTagClose = true;
	}
	
}
